home *** CD-ROM | disk | FTP | other *** search
- Path: news.mindlink.net!news
- From: Allan_Nienhuis@mindlink.bc.ca (Allan Nienhuis)
- Newsgroups: comp.lang.c++
- Subject: Re: 2D pointer array to class overwritten
- Date: Mon, 08 Apr 1996 14:39:44 GMT
- Organization: MIND LINK! - British Columbia, Canada
- Message-ID: <4kb89l$2to@fountain.mindlink.net>
- References: <4k89ap$7fl@ctylnk.cityu.edu.hk> <9604071928.AA001og@lorelei.demon.co.uk>
- NNTP-Posting-Host: line013.abb.mindlink.net
- X-Newsreader: Forte Free Agent 1.0.82
-
- John Croudy <john@lorelei.demon.co.uk> wrote:
-
- >I'm sure I'm not the only one who spotted the [i,j] instead of [i][j].
-
- >But why doesn't the compiler at least warn about this? I tried and
- >couldn't get a warning out of GNU.
-
- This is rather cryptic :) (also perfectly legal)
-
- i is being evaluated, and it's evaluation is being discarded, then j
- is evaluated and used in the [] pointer reference.
-
- consider this from the Borland vers 3.1 help file:
-
-
- ***************************************************
- Comma punctuator and operator ( , )
-
- The comma separates the elements of a function argument list.
-
- The comma is also used as an operator in comma expressions. Mixing the
- two uses of comma is legal, but you must use parentheses to
- distinguish them.
-
- Syntax
-
- expression , assignment-expression
-
- The left operand E1 is evaluated as a void expression, then E2 is
- evaluated to give the result and type of the comma expression. By
- recursion, the expression
-
-
- E1, E2, ..., En
-
- results in the left-to-right evaluation of each Ei, with the value and
- type of En giving the result of the whole expression.
-
- To avoid ambiguity with the commas used in function argument and
- initializer lists, parentheses must be used. For example,
-
-
- func(i, (j = 1, j + 4), k);
-
- calls func with three arguments, not four. The arguments are i, 5, and
- k.
-
- ***************************************************
-
-